package com.zy.mobile.message.push.faio;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.zy.mobile.message.push.bio.BioTimeServerHandler;

/**
 * 伪异步IO的服务处理类线程池
 * @author zhangyi
 *
 */
public class TimeServerHandlerExcutePool {
	
	private ExecutorService executor;
	
	public TimeServerHandlerExcutePool(int maxPoolSize,int queueSize) {
		// TODO Auto-generated constructor stub
		executor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),maxPoolSize,120L,TimeUnit.SECONDS,
				new ArrayBlockingQueue<Runnable>(queueSize));
	}
	
	public void excute(BioTimeServerHandler task){
		executor.execute(task);
	}
}
